import time

class Man:
    #姓名
    __name =""
    #性别
    __sex =""
    #年龄
    __age =0
    #话费余额
    __balance = 0
    #手机品牌
    __brand =""
    #电池容量
    __capa =0
    #手机屏幕大小
    __screen = 0
    #待机时长
    __standby =0
    #拥有积分
    __integral =0
    def setName(self,name):
        if name =="":
            print("你输入的姓名有误")
        else:
            self.__name=name
    def getName(self):
        return self.__name



    def setSex(self,sex):
        if sex !="男" or sex !="女":
            print("你输入的性别有误")
    def getSex(self):
        return self.__sex



    def setAge(self,age):
        if age<0 or age >140:
            print("你输入的年龄有误")
        else:
            self.__age=age
    def getAge(self):
        return self.__age


    def setBalance(self,balance):
        if balance<0:
            print("话费不能小于0")
        else:
            self.__balance=balance
    def getBalance(self):
        return self.__balance



    def setBrand(self, brand):
        if brand == "":
            print("你输入有误")
        else:
            self.__brand=brand

    def getBrand(self):
        return self.__brand

    def setCapa(self, capa):
        if capa < 100 or capa > 10000:
            print("手机电池容量不符合要求")
        else:
            self.__capa = capa

    def getCapa(self):
        return self.__capa

    def setScreen(self, screen):
        if screen < 4 or screen > 10:
            print("请输入正确的屏幕尺寸")
        else:
            self.__screen = screen

    def getScreeen(self):
        return self.__screen

    def setStandby(self, standby):
        if standby < 1:
            print("该换手机啦")
        elif standby > 100:
            print("在等几年就有啦")
        else:
            self.__standby = standby
    def getStandby(self):
        return self.__standby



    def setIntergral(self, integral):
        if integral < 0:
            print("积分都没啦！！")
        else:
            self.__integral = integral
    def getIntegral(self):
        return self.__integral

    def text(self,text):
        print(self.getName(),"正在发信息：",text)

    def call(self,number,time1):
        if  self.__balance<1:
            print("话费不足，请续交话费后进行操作")
        elif number =="":
            print("你所拨打的电话为空号")
        else:
            print(self.getName(),"正在给【",number,"】打电话")
            for i in range(10):
                print(".",end=" ")
                time.sleep(1)
            print("电话接通")

            if time1>0 and time1<10:
                self.__balance =self.__balance-(1*time1)
                self.__integral=self.__integral+(15*time1)
                print("你的话费余额为：",self.__balance,"你的积分为：",self.__integral)
            elif time1>10 and time1<20:
                self.__balance =self.__balance-(0.8*time1)
                self.__integral=self.__integral+(39*time1)
                print("你的话费余额为：",self.__balance,"你的积分为：",self.__integral)
            else:
                self.__balance =self.__balance-(0.65*time1)
                self.__integral=self.__integral+(48*time1)
                print("你的话费余额为：",self.__balance,"你的积分为：",self.__integral)
    def exchange(self):
        print("请问需要兑换积分吗？ y,n")
        str=input("请输入y或n")
        if str=="y":
            self.__balance =self.__balance+(self.__integral/30)
            self.__integral = self.__integral-self.__integral
            print("你的话费余额为：",self.__balance)
            print("你的积分剩余：",self.__integral)
        elif str=="n":
            print("欢迎下次使用")
        else:
            print("请正确输入")
op=Man()

op.name ="张星彩"
#性别
op.sex ="女"
#年龄
op.age ="10"
#话费余额
op.setBalance(100)
#手机品牌
op.setBrand("oppo")
#电池容量
op.setCapa(1000)
#手机屏幕大小
op.setScreen(9)
#待机时长
op.setStandby(10)
#拥有积分
op.setIntergral(10)
op.text("maka")
op.call("12121133344",30)
op.exchange()
